<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>02-指令修饰符-事件修饰符和v-model修饰符</title>
    <style>
        .father {
          width: 200px;
          height: 200px;
          background-color: pink;
          margin-top: 20px;
        }
        .son {
          width: 100px;
          height: 100px;
          background-color: skyblue;
        }
      </style>
</head>
<body>
    <div id="app">
        <h1>v-model修饰符 .trim .number</h1>
        姓名：<input v-model.trim="username" type="text"><br>
        年龄：<input v-model.number.trim="age" type="text"><br>

        <h1>@事件名.stop   →  阻止冒泡</h1>
        <div class="father" @click="fatherFn">
            <div class="son" @click.stop="sonFn">儿子</div>
        </div>

        <h1>@事件名.prevent  →  阻止默认行为</h1>
        <a href="http://www.baidu.com" @click.prevent>阻止默认行为</a>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"></script>
    <script>
        const app = new Vue({
            el:'#app',
            data:{
                username:'',
                age:''
            },
            methods: {
                fatherFn() {
                    alert('我是爹 我被点击了！')
                },
                sonFn() {
                    // e.stopPropagation()
                    
                    alert('我是儿 我被点击了！')
                }
            },
        })
    </script>
</body>
</html>